//
//  MSImageExclusief.h
//  ImageExport
//
//  Created by Jelle De Laender on 30/01/07.
//  Copyright 2007 GetDrawIt. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "CHGeometryExtensions.h"

@interface NSImage (CHImageAdditions)

//clipping an image
- (NSImage *)imageByCroppingToRect:(NSRect)aRect;
- (NSImage *)imageByResizingToSize:(NSSize)size;

/* Load an Image from data (with dpi etc) */
+ (id)imageFromPath:(NSString *)path;
+ (id)imageFromData:(NSData *)data type:(NSString *)type;
+ (id)imageFromCGImageRef:(CGImageRef)image; //do not use

#pragma mark Respresentation methods

-(NSData *)JPGRepresentationWithCompression:(float)compression;
-(NSData *)PNGRepresentationWithInterlaced:(BOOL)interlaced;
-(NSData *)GIFRepresentationWithTransparency:(BOOL)transparency;

#pragma mark Export methods - local

- (void)copyToClipboard;

/* Note: You don't need to give .app extension. The app must be installed in the 'app-folder' examples: Mail, iPhoto, DrawIt, QuickScale */
- (void)openWith:(NSString *)application;
- (void)openWith:(NSString *)application fileType:(NSString *)type option:(NSNumber *)option;
- (BOOL)uploadToImageShack;

-(void)flipHorizontal;
-(void)flipVertical;
-(void)rotateClockwise;
-(void)rotateAntiClockwise;

@end

@interface NSData (ImageShackUploadHelpers)
- (NSData*)generateFormData:(NSDictionary*)dict;
- (NSString *)stripXML:(NSString *)xml;
- (BOOL)uploadFormToImageShack;

@end

@interface CIImage (CHCIImageAdditions)
- (NSData *)JPGRepresentationWithCompression:(float)compression;
- (NSData *)PNGRepresentationWithInterlaced:(BOOL)interlaced;
- (NSData *)GIFRepresentationWithTransparency:(BOOL)transparency;
- (NSData *)TIFFRepresentation;
- (void)copyToClipboard;
- (BOOL)uploadToImageShack;
@end

@interface NSBitmapImageRep (CHBitmapRepAdditions)
- (NSData *)JPGRepresentationWithCompression:(float)compression;
- (NSData *)PNGRepresentationWithInterlaced:(BOOL)interlaced;
- (NSData *)GIFRepresentationWithTransparency:(BOOL)transparency;
@end